package com.app.testDemo.controller;

import com.app.testDemo.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * Created by zhangzhiling on 2017/7/28.
 */
@Controller
@RequestMapping("/demo")
public class DemoController {

@Autowired
private DemoService demoService;

@RequestMapping("/login")
public String title(ModelMap model) {
    model.addAttribute("message", "Hello world!");
    return "demo/login";
}

    @RequestMapping("/table")
    public String content(ModelMap model) {

        List<Map<String,Object>> list = demoService.list();
        model.addAttribute("list", list);
        return "demo/table";
    }


    @RequestMapping("/saleDate")
    @ResponseBody
    public  List<Map<String,Object>> saleDate(ModelMap model) {

        List<Map<String,Object>> list = demoService.saleType();
        return list;

    }

    @RequestMapping("/getPriceCount")
    @ResponseBody
    public  List<Map<String,Object>> getPriceCount(ModelMap model) {

        List<Map<String,Object>> list = demoService.getPriceCount();
        return list;

    }

    @RequestMapping("/getEvaluate")
    @ResponseBody
    public  List<Map<String,Object>> getEvaluate(ModelMap model) {

        List<Map<String,Object>> list = demoService.getEvaluate();
        return list;

    }
}
